#include <iostream>
#include <vector>
using namespace std;
typedef unsigned long long Int64;
typedef char Int8;
class TGluing {
public:
  Int64 gmask, gargn;
  inline bool isSubGluing(const TGluing b) {
    if ((b.gmask | gmask) != gmask) return false;
    return (b.gargn & ~gmask) == (gargn & ~gmask);
  }  
  inline Int64 getGluingMask(const TGluing b) {
    if (b.gmask != gmask) return false;
    Int64 m, m2; m = m2 = (b.gargn & ~gmask) ^ (gargn & ~gmask); 
    while (m2 > 0) {
      if ((m2 & 1) == 1) {
        if ((m2 >> 1) > 0) return 0;
        else break;
      }
      m2 >>= 1;      
    }
    return m;   
  }
  inline TGluing() {
    gmask = 0;
    gargn = 0;
  }
  inline TGluing(const Int64 mask, const Int64 argn) {
    gmask = mask;
    gargn = argn;
  }
  inline TGluing(const TGluing a, const Int64 mask) {
    gmask = a.gmask ^ mask;
    gargn = a.gargn & ~gmask;
  }
};

ostream& operator << (ostream &stream, TGluing &a) {
  stream << '(' << a.gmask << ',' << a.gargn << ')';
  return stream;
}

Int8 getComp(Int64 f, Int8 n) {
  vector<TGluing> a;
  Int8 i = 0;
  while(f != 0) {
    if ((f & 1) == 1) a.push_back(TGluing(0,i));
    f >>= 1;
    i++;
  }  
  for(size_t i = 0; i < a.size(); i++)
    for(size_t j = 0; j < a.size(); j++) if (i != j) {
      if (a[i].isSubGluing(a[j])) {
        //cout << a[j] << "<=" << a[i] << endl;
        a.erase(a.begin() + j);
        j--;
      } else {
        Int64 m = a[i].getGluingMask(a[j]);
        if (m != 0) {
          a.push_back(TGluing(a[i],m));        
          //cout << "New gluing " << a.back() << " by " << a[i] << ',' << a[j] << endl;          
          if (i < j) {
            a.erase(a.begin() + j);
            a.erase(a.begin() + i);
          } else {
            a.erase(a.begin() + i);
            a.erase(a.begin() + j);            
          }
          i--;
          break;
        }
      }
    }
  //for(size_t i = 0; i < a.size(); i++) cout << a[i] << endl;
  return a.size();   
}



int main() {
  Int64 f;
  for(f = 0; f < 10000; f++)
  cout << f << ' ' << (int)getComp(f,5) << endl;
  
}
